var userinfo ={};
var user = {


	getAppRoot:function () {
		var pathname = window.document.location.pathname;
		var pname = pathname.substring(0, pathname.substr(1).indexOf("/") + 1);
		return pname;
	},
	getUserInfo : function(cb) {
	
		$.ajax({
			type : "post",
			url : user.getAppRoot()+"/pub/userInfo/getCurUserInfoForSession",  
			async : false,
			dataType : "json",
			beforeSend : function() {
			
			},
			success : function(data) {
				if (data.respCode == "0") {
					 console.log(data);
					 userinfo=data.userinfo;
					 cb(data);		
				} else {
                
					top.location.href=user.getAppRoot()+"/index.html";  
					oEvent.preventDefault(); 
				}
				
				
		
			},
			error : function(err) {
				  console.log("系统忙，请稍后再试！");
			}
		});
	}

};

var userExInfo={};
var userEx = {


		getAppRoot:function () {
			var pathname = window.document.location.pathname;
			var pname = pathname.substring(0, pathname.substr(1).indexOf("/") + 1);
			return pname;
		},
		getUserInfo : function(cb) {
		var that=this;
		var actionName="/pub/userInfo/getCurUserInfoForSession";
			$.ajax({
				type : "post",
				//url : config.domain+"/userInfo/getCurUserInfoForSession.mvc",  
				url:config.domain!=""?config.domain+actionName:user.getAppRoot()+actionName,
				async : false,
				dataType : "json",
				beforeSend : function() {
				
				},
				success : function(data) {
					if (data.respCode == "0") {
						 console.log(data);
						 userExInfo = data.userinfo;
						 cb(data);		
					} else {
	                
						var indexurl="/index.html";
						top.location.href=config.domain!=""?config.domain+indexurl:user.getAppRoot()+indexurl;  
						oEvent.preventDefault(); 
					}
					
					
			
				},
				error : function(err) {
					  console.log("系统忙，请稍后再试！");
				}
			});
		}

	};


//$(function (){
   // user.getUserInfo(function(){});
   userEx.getUserInfo(function(){});
//});

